package thread.productcomsumer;

public class Consumer implements Runnable {
    private Source source;

    public Consumer(Source source) {
        this.source = source;
    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            try {
                String result = (String) source.poll();
                System.out.println("消费："+result);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
